package com.zzzyh.forumsystemclient.cotroller;

import com.zzzyh.forumsystemclient.common.AppResult;
import com.zzzyh.forumsystemclient.services.IUser_UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 郑雨杭
 * @create 2025/6/18 - 13:43
 */
@RestController
@Slf4j
@RequestMapping("/userUser")
public class UserUserController {
    @Autowired
    private IUser_UserService user_userService;

    @RequestMapping("/getUserFollowAuthor")
    //0无关1互关2前关注后3后关注前
    public AppResult<Boolean> getUserFollowAuthor(Long userId, Long authorId){
        log.info("123:{},{}",userId,authorId);
        return AppResult.success(user_userService.getUserFollowAuthor(userId, authorId));
    }

    @RequestMapping("/unFollowAuthor")
    //0无关1互关2前关注后3后关注前 以及关注取关
    public AppResult<Void> unFollowAuthor(Long userId, Long authorId){
        user_userService.unFollowAuthor(userId, authorId);
        return AppResult.success();
    }

    @RequestMapping("/followAuthor")
    //0无关1互关2前关注后3后关注前 以及关注取关
    public AppResult<Void> followAuthor(Long userId, Long authorId){
        user_userService.followAuthor(userId, authorId);
        return AppResult.success();
    }
}
